home *** CD-ROM | disk | FTP | other *** search
/ Turnbull China Bikeride / Turnbull China Bikeride - Disc 2.iso / STUTTGART / UTIL / MEMORY / OLD / MEM208SRC / FSLib / c / _Args next >
Text File  |  1993-08-22  |  2KB  |  70 lines

  1. /* Original code (c) Acorn Computers Ltd, 1992-3 */
  2.  
  3. /* $Id: c._Args 3.1 93/03/09 20:15:13 brian Exp $ */
  4.  
  5. #include "FS.h"
  6.  
  7. /* #define DEBUG */
  8.  
  9. _kernel_oserror    *fsentry_args( FSEntry_Args_Parameter *parm )
  10. {
  11.   FileEntry *fe=(FileEntry *)parm->_.handle;
  12.   FileDesc d = FileEntry_Desc( fe );
  13. #ifdef DEBUG
  14.   printf("Args(%d)\n",parm->reason);
  15. #endif
  16.  
  17.   switch( parm->reason )
  18.   {
  19.   case FSEntry_Args_Reason_ReadSequentialFilePointer:
  20.     if (d.buffered)
  21.       return ERR(mb_BadParameters);
  22.     parm->arg.sequential_pointer=FileEntry_SeqPtr(fe);
  23.     return NULL;
  24.     
  25.   case FSEntry_Args_Reason_WriteSequentialFilePointer:
  26.     if (d.buffered)
  27.       return ERR(mb_BadParameters);
  28.     return FileEntry_SetSeqPtr(fe, parm->arg.sequential_pointer );
  29.  
  30.   case FSEntry_Args_Reason_ReadFileExtent:
  31.     if (d.buffered)
  32.       return ERR(mb_BadParameters);
  33.     parm->arg.extent=d.length;
  34.     return NULL;
  35.  
  36.   case FSEntry_Args_Reason_WriteFileExtent:
  37.     return FileEntry_SetLength(fe,parm->arg.extent);
  38.  
  39.   case FSEntry_Args_Reason_ReadSizeAllocatedToFile:
  40.     parm->arg.allocation_size=FileEntry_Allocated(fe);
  41.     return NULL;
  42.  
  43.   case FSEntry_Args_Reason_EOFCheck:
  44.     if (d.buffered)
  45.       return ERR(mb_BadParameters);
  46.     parm->_.Not_Yet_EOF=FileEntry_SeqPtr(fe)!=d.length;
  47.     return NULL;
  48.  
  49.   case FSEntry_Args_Reason_FlushFileBuffer:
  50.     parm->arg.info=d.info;    
  51.     return FileEntry_Flush(fe);
  52.  
  53.   case FSEntry_Args_Reason_EnsureFileSize:
  54.     {
  55.       _kernel_oserror *err=FileEntry_EnsureSize(fe,parm->arg.allocation_size);
  56.       parm->arg.allocation_size=FileEntry_Allocated(fe);
  57.       return err;
  58.     }
  59.   case FSEntry_Args_Reason_WriteZerosToFile:
  60.     return FileEntry_PutZeros(fe,parm->arg.write_zeros.start,parm->arg.write_zeros.number);
  61.   case FSEntry_Args_Reason_ReadFileDateStamp:
  62.     parm->arg.info=d.info;
  63.     return NULL;
  64.   case 10:
  65.     return NULL;
  66.   default:
  67.     return ERR(mb_BadParameters);
  68.   }
  69. }
  70.